package cc.vv.btpartyjob.partyservice.adapter

import android.widget.TextView
import cc.vv.baselibrary.adapter.SimpleCommonAdapter
import cc.vv.baselibrary.adapter.holder.ExtendViewHolder
import cc.vv.baselibrary.view.LKCircleImageView
import cc.vv.btpartyjob.jnimodule.server.OperationServer
import cc.vv.btpartyjob.partyservice.R
import cc.vv.btpartyjob.partyservice.module.bean.MessageBoardBean
import cc.vv.lkimagecomponent2.LKImage
import cc.vv.lkimagecomponent2.lib.mode.ScaleMode

/**
 * 留言板adapter
 * Created by Chen.qi on 2018/10/24.
 */
class MessageBoardAdapter(layoutResId: Int) : SimpleCommonAdapter<MessageBoardBean>(layoutResId) {
    override fun convert(helper: ExtendViewHolder, item: MessageBoardBean, position: Int) {
        //头像

        LKImage.load().scale(ScaleMode.CENTER_CROP)
                .crossFade(300).placeHolder(R.mipmap.icon_def_image)
                .error(R.mipmap.icon_def_image).load(item.faceUrl)
                .into(helper.getView<LKCircleImageView>(R.id.liv_imb_headPic))

        //姓名
        helper.getView<TextView>(R.id.tv_imb_userName)?.text = item.name
        //支部
        helper.getView<TextView>(R.id.tv_imb_zhiBu)?.text = item.branch

        //标题
        helper.getView<TextView>(R.id.tv_imb_title)?.text = item.title

        //内容
        helper.getView<TextView>(R.id.tv_imb_content)?.text = item.conetnt

        //回复数量
        helper.getView<TextView>(R.id.tv_imb_huiFuNumber)?.text = item.count

        //留言发布时间
        helper.getView<TextView>(R.id.tv_imb_huiFuData)?.text = OperationServer.formatStr(item.createTime)

    }
}